/**
 * 
 */

function animatetable() {
	//This function animates bank and the player info, on mouse over makes them solid
	$("#player1").mouseover(function() {$("#player1").css("opacity", "1");});
	$("#player1").mouseout(function() {$("#player1").css("opacity", "0.5");});
	$("#player2").mouseover(function() {$("#player2").css("opacity", "1");});
	$("#player2").mouseout(function() {$("#player2").css("opacity", "0.5");});
	$("#player3").mouseover(function() {$("#player3").css("opacity", "1");});
	$("#player3").mouseout(function() {$("#player3").css("opacity", "0.5");});
	$("#player4").mouseover(function() {$("#player4").css("opacity", "1");});
	$("#player4").mouseout(function() {$("#player4").css("opacity", "0.5");});
	$("#player5").mouseover(function() {$("#player5").css("opacity", "1");});
	$("#player5").mouseout(function() {$("#player5").css("opacity", "0.5");});
	$("#player6").mouseover(function() {$("#player6").css("opacity", "1");});
	$("#player6").mouseout(function() {$("#player6").css("opacity", "0.5");});
	$("#player7").mouseover(function() {$("#player7").css("opacity", "1");});
	$("#player7").mouseout(function() {$("#player7").css("opacity", "0.5");});
	$("#player8").mouseover(function() {$("#player8").css("opacity", "1");});
	$("#player8").mouseout(function() {$("#player8").css("opacity", "0.5");});
	$("#player9").mouseover(function() {$("#player9").css("opacity", "1");});
	$("#player9").mouseout(function() {$("#player9").css("opacity", "0.5");});
}

function dealcards(i,n){
	//This function deals all the player cards at the start of the game
	if (i==1 & n==10){
		return
	}
	var id="#player"+n+"_"+i;
	i+=1;
	if (i==3){
		i=1;
		n+=1;
	}
	var top=$(id).css("top");
	var left=$(id).css("left");
	$(id).css({"top":"465px","left":"968px","opacity":"1"});
	$(id).animate({ 
        "top": top, 
        "left": left
    },200, function(){dealcards(i,n);});
}

function dealtcards(i,n){
	//Deals cards to the center of the table, when needed
	if (i>n){
		return
	}
	var id="#t_card"+i;
	i+=1;
	var top=$(id).css("top");
	var left=$(id).css("left");
	var width=$(id).css("width");
	var height=$(id).css("height");
	$(id).css({"top":"465px","left":"968px","width":"60px","height":"80px","opacity":"1"});
	$(id).animate({ 
        "top": top, 
        "left": left,
        "width": width,
        "height": height
    },500, function(){dealtcards(i,n);});
	$(id).css({"top":top,"left":left,"width":width,"height":height});
}

function returnacard(id){
	//Return any card at all to the card desk
	var top=$(id).css("top");
	var left=$(id).css("left");
	var width=$(id).css("width");
	var height=$(id).css("height");
	$(id).animate({ 
		"top": "465px", 
		"left": "968px",
		"width": "60px",
		"height": "80px"
    },1000);
	$(id).animate({"top":top,"left":left,"width":width,"height":height,"opacity":"0"},0);
}

function activeplayer(id){
	//activates the player
	$(id).animate({"left": "-=10px","top":"-=7px", "width":"140","height":"46"},500);
}

function notactiveplayer(id){
	$(id).animate({"left": "+=10px","top":"+=7px", "width":"120","height":"32"},500);
}